package me.leiusual.sharing.repository.datasource

import androidx.lifecycle.MutableLiveData
import androidx.paging.DataSource
import me.leiusual.sharing.api.ApiSharing
import me.leiusual.sharing.api.model.Withdraw

/**
 * author: leiusual
 * create on: 2019-08-01
 * description:
 */
class WithdrawDataSourceFactory(
    private val apiSharing: ApiSharing,
    private val storeId: Long
) : DataSource.Factory<Int, Withdraw>() {

  val withdrawDataSource = MutableLiveData<WithdrawDataSource>()

  override fun create(): DataSource<Int, Withdraw> {
    val dataSource = WithdrawDataSource(apiSharing, storeId)
    withdrawDataSource.postValue(dataSource)
    return dataSource
  }
}